package model

import "todo-list/utils/secret"

type User struct {
	BaseModel
	UserName     string `gorm:"unique"`
	NickName     string
	UserPassword string
	Email        string
	Tasks        []Task
}

func (u *User) SetPwd(pwd string) {
	u.UserPassword = secret.Md5(pwd)
}

func (u *User) VerifyPwd(pwd string) bool {
	return secret.Verify(pwd, u.UserPassword)
}
